home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / gfx / show / gs_src_gs.lha / gs5.03 / gpcheck.h < prev    next >
C/C++ Source or Header  |  1996-01-29  |  2KB  |  54 lines

  1. /* Copyright (C) 1992, 1994 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of Aladdin Ghostscript.
  4.   
  5.   Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  6.   or distributor accepts any responsibility for the consequences of using it,
  7.   or for whether it serves any particular purpose or works at all, unless he
  8.   or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  9.   License (the "License") for full details.
  10.   
  11.   Every copy of Aladdin Ghostscript must include a copy of the License,
  12.   normally in a plain ASCII text file named PUBLIC.  The License grants you
  13.   the right to copy, modify and redistribute Aladdin Ghostscript, but only
  14.   under certain conditions described in the License.  Among other things, the
  15.   License requires that the copyright notice and this notice be preserved on
  16.   all copies.
  17. */
  18.  
  19. /* gpcheck.h */
  20. /* Interrupt check interface */
  21.  
  22. /*
  23.  * On some platforms, the interpreter must check periodically for user-
  24.  * initiated actions.  (Eventually, this may be extended to all platforms,
  25.  * to handle multi-tasking through the 'context' facility.)  Routines that
  26.  * run for a long time must periodically call gp_check_interrupts(), and
  27.  * if it returns true, must clean up whatever they are doing and return an
  28.  * e_interrupted (or gs_error_interrupted) exceptional condition.
  29.  * The return_if_interrupt macro provides a convenient way to do this.
  30.  *
  31.  * On platforms that require an interrupt check, the makefile defines
  32.  * a symbol CHECK_INTERRUPTS.  Currently this is only the Microsoft
  33.  * Windows platform.
  34.  */
  35.  
  36. #ifdef CHECK_INTERRUPTS
  37. int gp_check_interrupts(P0());
  38. int gs_return_check_interrupt(P1(int code));
  39. #  define process_interrupts() discard(gp_check_interrupts())
  40. #  define return_if_interrupt()\
  41.     { int icode_ = gp_check_interrupts();\
  42.       if ( icode_ )\
  43.     return gs_note_error((icode_ > 0 ? gs_error_interrupt : icode_));\
  44.     }
  45. #  define return_check_interrupt(code)\
  46.     return gs_return_check_interrupt(code)
  47. #else
  48. #  define gp_check_interrupts() 0
  49. #  define process_interrupts() DO_NOTHING
  50. #  define return_if_interrupt()    DO_NOTHING
  51. #  define return_check_interrupt(code)\
  52.     return (code)
  53. #endif
  54.